package com.example.caoh.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import com.example.caoh.entity.SysUser;

public class BaseController {

	 public static SysUser currentLoginUser() {
	        Subject subject = SecurityUtils.getSubject();
	        if (subject.isAuthenticated()) {
	            Object principal = subject.getPrincipals().getPrimaryPrincipal();
	            if (principal instanceof SysUser) {
	                return (SysUser) principal;
	            }
	        }
	        return null;
	    }
}
